package com.qyer.search.model;

import java.util.*;
/**
 * Created by tangzheng on 16/7/15.
 */
public class ExtendVType {
  //STG which need extend
  private Set<Integer> _STG;
  //ST which  need extend
  private Set<Integer> _ST;

  public ExtendVType(Set<Integer> _STG, Set<Integer> _ST) {
    this._STG = _STG;
    this._ST = _ST;
  }

  public ExtendVType(){
    this._ST = new HashSet<>();
    this._STG = new HashSet<>();
  }

  public Set<Integer> get_ST() {
    return _ST;
  }

  public void set_ST(Set<Integer> _ST) {
    this._ST = _ST;
  }

  public Set<Integer> get_STG() {
    return _STG;
  }

  public void set_STG(Set<Integer> _STG) {
    this._STG = _STG;
  }

  public boolean needExtend(int id){
    if(_STG.contains(id))
      return true;
    if(_ST.contains(id))
      return true;
    return false;
  }

  //old
  public boolean needExtend(SearchParameter searchParameter){
    int id1 = searchParameter.getType1();
    int id2 = searchParameter.getType2();
    if(_STG.contains(id1) || _STG.contains(id2))
      return true;
    if(_ST.contains(id1) || _ST.contains(id2))
      return true;
    return false;
  }
  //new
  public boolean needExtend2(SearchParameter searchParameter){
    int id1 = searchParameter.getType1();
    int id2 = searchParameter.getType2();
    if((id1 <=0) && (id2 <= 0))
      return true;
    if(_STG.contains(id1) || _STG.contains(id2))
      return true;
    if(_ST.contains(id1) || _ST.contains(id2))
      return true;
    return false;
  }
}
